<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Error extends CI_Controller {
    public function errors() {
        $this->template->set_layout('orpms');
            
        $this->template->set_partial('styles','partials/styles');
        $this->template->set_partial('scripts_a','partials/scripts_a');
        $this->template->set_partial('header','partials/header');
        $this->template->set_partial('subnav','partials/subnav');
        
        if($this->session->userdata('username')) {
            $this->template->set_partial('navigation','partials/navigation');
        }
        
        $this->template->set_partial('scripts_b','partials/scripts_b');
        $this->template->set_partial('footer','partials/footer');
        
        switch($_GET['code']) {
            case 401:
                $this->template->title('Error 401 - ORPMS');
                $this->template->build('pages/error/401');
                break;
            case 403:
                $this->template->title('Error 403 - ORPMS');
                $this->template->build('pages/error/403');
                break;
            case 404:
                $this->template->title('Error 404 - ORPMS');
                $this->template->build('pages/error/404');
        }
    }
}